package index.query;

import compiler.absyn.Constant;

import index.Index;
import storage.record.RID;



public class IndexSelectScan implements RidScan {
	private Index idx;
	private Constant val;

	

	public IndexSelectScan(Index idx, Constant val) {
		this.idx = idx;
		this.val = val;
		beforeFirst();
	}

	

	public void beforeFirst() {
		idx.beforeFirst(val);
	}

	

	public boolean next() {
		return idx.next();
	}

	

	public void close() {
		idx.close();
	}

	

	public Constant getVal(String fldname) {
		throw new RuntimeException("field " + fldname + " not found.");
	}


	public int getInt(String fldname) {
		throw new RuntimeException("field " + fldname + " not found.");
	}

	

	public String getString(String fldname) {
		throw new RuntimeException("field " + fldname + " not found.");
	}

	

	public boolean hasField(String fldname) {
		return false;
	}


	public RID getDataRid() {
		return idx.getDataRid();
	}
}
